<template>
  <div class="banner-box">
    <div class="banner" @click="gallaryShowClick">
      <div class="banner-img">
        <img class="banner-item" :src="bannerImg" />
      </div>
      <div class="banner-title">{{sightName}}</div>
      <div class="banner-num"><span class="iconfont">&#xe626;</span>{{bannerNum}}</div>
    </div>
    <common-fade>
       <common-gallary :imgs="gallaryImgs"  v-show="gallaryShow"  @gallaryChange="gallaryChange"></common-gallary>
    </common-fade>
  </div>

</template>

<script>
import CommonGallary from 'common/gallary/Gallary.vue'
import CommonFade from 'common/fade/Fade.vue'
export default {
  name: 'Banner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data: function () {
    return {
      gallaryShow: false
    }
  },
  methods: {
    gallaryShowClick: function () {
      this.gallaryShow = true
    },
    gallaryChange: function () {
      this.gallaryShow = false
    }
  },
  components: {
    CommonGallary,
    CommonFade
  },
  computed: {
    bannerNum: function () {
      return this.gallaryImgs.length
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    overflow:hidden
    height:0
    padding-bottom: 55%
    .banner-img
      height: 4rem;
      .banner-item
        width:100%
        height:100%
    .banner-title
      position: absolute
      left: .2rem
      bottom:.4rem
      font-size: .3rem
      color:#fff
    .banner-num
      position: absolute
      left: .2rem
      bottom:.9rem
      font-size: .15rem
      color:#fff
      padding: .07rem  .25rem
      line-height: .3rem
      background: #000
      border-radius: .1rem
      opacity: .7
</style>
